﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Bookvar.UI.Converters
{
    public class CountToFontSizeConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            const int minFontSize = 6;
            const int maxFontSize = 38;
            const int increment = 2;

            int count = (int) value;
            int fontSize = minFontSize + count * increment;
            return (fontSize < maxFontSize) ? fontSize : maxFontSize;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}